package de.lusiardi.webdav.xml;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.w3c.dom.Element;

/**
 * http://www.webdav.org/specs/rfc4918.html#ELEMENT_error
 *
 * @author Joachim Lusiardi
 */
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Error {

    @XmlAnyElement
    private List<Element> errors;

    public Error() {
        errors = new ArrayList<Element>();
    }

    public List<Element> getErrors() {
        return errors;
    }

    public void setErrors(List<Element> errors) {
        this.errors = errors;
    }

    public void addRemoveOrSet(Element ars) {
        if (errors == null) {
            errors = new ArrayList<Element>();
        }
        errors.add(ars);
    }
}
